import org.lobobrowser.gui._
import org.lobobrowser.main._
import javax.swing._
import java.awt.Frame
import java.awt._

class GUI extends JFrame  
{
	val homePage = "http://google.co.il"
		
	//control panel
	var controlPanel  = new JPanel()
	controlPanel.setLayout(new BoxLayout(controlPanel, BoxLayout.LINE_AXIS))
	getContentPane().add(controlPanel);
	controlPanel.setAlignmentX(Component.LEFT_ALIGNMENT)
	
	//back
	var backButton = new JButton
	controlPanel.add(backButton,BorderLayout.WEST);
	backButton.setIcon(new ImageIcon("back.png"))
	backButton.setAlignmentX(Component.LEFT_ALIGNMENT)
	backButton.setMargin(new Insets(0,0,0,0))
	
	//forward
	var fwdButton = new JButton
	controlPanel.add(fwdButton);
	fwdButton.setIcon(new ImageIcon("fwd.png"))
	fwdButton.setAlignmentX(Component.LEFT_ALIGNMENT)
	fwdButton.setMargin(new Insets(0,0,0,0))
	
	//home
	var homeButton = new JButton
	controlPanel.add(homeButton);
	homeButton.setIcon(new ImageIcon("home.png"))
	homeButton.setAlignmentX(Component.LEFT_ALIGNMENT)
	homeButton.setMargin(new Insets(0,0,0,0))
	
	//refresh
	var refreshButton = new JButton
	controlPanel.add(refreshButton);
	refreshButton.setIcon(new ImageIcon("refresh.png"))
	refreshButton.setAlignmentX(Component.LEFT_ALIGNMENT)
	refreshButton.setMargin(new Insets(0,0,0,0))
	
	//stop
	var stopButton = new JButton
	controlPanel.add(stopButton);
	stopButton.setIcon(new ImageIcon("stop.png"))
	stopButton.setAlignmentX(Component.LEFT_ALIGNMENT)
	stopButton.setMargin(new Insets(0,0,0,0))
	
	//newtab
	var tabButton = new JButton
	controlPanel.add(tabButton)
	tabButton.setIcon(new ImageIcon("plus.png"))
	tabButton.setAlignmentX(Component.LEFT_ALIGNMENT)
	tabButton.setMargin(new Insets(0,0,0,0))
	
	//deletetab
	var delButton = new JButton
	controlPanel.add(delButton)
	delButton.setIcon(new ImageIcon("minus.png"))
	delButton.setAlignmentX(Component.LEFT_ALIGNMENT)
	delButton.setMargin(new Insets(0,0,0,0))
		
	//url
	var url = new JTextField
	controlPanel.add(url);
	url.setAlignmentX(Component.LEFT_ALIGNMENT)
	url.setMaximumSize(new Dimension(1000000,60))
	//url.setText(homePage)
	url.setFont(new Font("Ariel",Font.PLAIN,20))
	
	//tab panel
	var tabPanel  = new JPanel()
	tabPanel.setLayout(new BoxLayout(tabPanel, BoxLayout.LINE_AXIS))
	getContentPane().add(tabPanel);
	tabPanel.setAlignmentX(Component.LEFT_ALIGNMENT)
	
	//tab
	var homeTab = new JButton
	tabPanel.add(homeTab);
	homeTab.setAlignmentX(Component.LEFT_ALIGNMENT)
	//homeTab.setMaximumSize(new Dimension(100,60))
	//homeTab.setText("Google")
	
	//display panel
	var displayPanel = new JPanel();
	displayPanel.setLayout(new BoxLayout(displayPanel, BoxLayout.LINE_AXIS))
	getContentPane().add(displayPanel);
	displayPanel.setAlignmentX(Component.LEFT_ALIGNMENT)
	
	//only for test - home tab 
	var framePanel = new FramePanel();
	displayPanel.add(framePanel);
	framePanel.navigate(homePage);
	framePanel.setAlignmentX(Component.LEFT_ALIGNMENT)
	//framePanel.addNavigationListener(new DownloadManager())
	
	
	//status bar
	var statusBar = new StatusBarPanel()
	getContentPane().add(statusBar);
	statusBar.setAlignmentX(Component.LEFT_ALIGNMENT)
	
	//frame options
	getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS))
	setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	setExtendedState(Frame.MAXIMIZED_BOTH);
	setVisible(true);	
	
}

